import { requestAPI, requestIPS } from '@/utils/requestCommerce'

// 我是承运商页面api
// 查询所有货主
export const getAllOwner = () => {
  return requestAPI.get('/owner/list')
}

// 查询货主分页
export const getPageOwner = (params) => {
  // return requestAPI.get(`/owner/${page}`)
  return requestAPI.get('/owner/page', { params })
}

// 模糊查询
export const getVagueOwner = (params) => {
  // return requestAPI.get(`/owner/${page}`)
  return requestAPI.get('/owner/vague', { params })
}

// /codeFactory/next/HZ 货主新增编号获取
export const getCodeOwner = () => {
  return requestAPI.get('/codeFactory/next/HZ')
}

// 新增  /owner
export const addOwner = (data) => {
  return requestAPI.post('/owner', data)
}

// 新增  /owner
export const updataOwner = (data) => {
  return requestAPI.put('/owner', data)
}

// 删除货主
export const deleteOwner = (ids) => {
  return requestAPI.delete(`/owner`, { params: { ids }})
}

// 查询货主详情
export const getOwner = (id) => {
  return requestAPI.get(`/owner/${id}`)
}

// 查询货主详情
export const getOwnerDetail = (id) => {
  return requestAPI.get(`/owner/detail/${id}`)
}

// 分页查询货主
export const getOwnerLocation = (params) => {
  return requestAPI.get(`/ownerLocation/pageDetail`, { params })
}

// 查询所有仓库
export const getAllWarehouse = () => {
  return requestAPI.get('/warehouse/list')
}

// 查询库区库位树
export const getAreaTree = (params) => {
  return requestAPI.get('/area/tree', { params })
}

// 货主批量关联库位
export const setOwnerLocation = (data) => {
  return requestAPI.post('/ownerLocation/batch', data)
}

// 删除货主-库位关联表
export const delOwnerLocation = (ids) => {
  return requestAPI.delete('/ownerLocation', { params: { ids }})
}
